package com.itheima.d4_innerclass4;

/**
 * 使用匿名内部类 实现Swimming的接口
 */
public class Test {
    public static void main(String[] args) {
        Swimming s1 = new Swimming(){
            @Override
            public void swim() {
                System.out.println("只见齐夏，跳入湖中消失不见...");
            }
        };
        start(new Swimming() {
            @Override
            public void swim() {
                System.out.println("陈俊南被乔家劲一拳破万法打入湖中游泳~~");
            }
        });
        start(s1);


        System.out.println("-------------------");
        s1.swim();
        System.out.println("-------------------");

    }
    public static void start(Swimming s){
        System.out.println("游泳开始了");
        s.swim();
        System.out.println("游泳终于结束了");
    }
}
